package com.zte.moon.yutu;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 14-1-5
 * Time: 上午3:29
 * To change this template use File | Settings | File Templates.
 */
public class Point {
    private int x;
    private int y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public void addX() {
        this.x++;
    }

    public void addY() {
        this.y++;
    }

    public void minusX() {
        this.x--;
    }

    public void minusY() {
        this.y--;
    }

    @Override
    public String toString() {
        return this.x + " " + this.y;
    }

    @Override
    public boolean equals(Object o) {
        if (this.x == ((Point) o).getX() && this.y == ((Point) o).getY())
            return true;
        else
            return false;
    }

    @Override
    public int hashCode() {
        //利用字符串的hashCode
        return this.toString().hashCode();
    }
}
